package jmx.dynamicmbean;

import java.lang.management.ManagementFactory;

import javax.management.MBeanServer;
import javax.management.ObjectName;

public class JMXAgent {

	public static void main(String args[]) throws Exception {
		TomcatServerController tomcatServerController = new TomcatServerController();
		MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
		ObjectName tomcatServerControllerName = new ObjectName("com.example.dmbeans:type=TomcatServerController");
		mBeanServer.registerMBean(tomcatServerController, tomcatServerControllerName);
		System.out.println("JMX Agent Running ... ");
		Thread.sleep(Long.MAX_VALUE);
	}

}
